﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="BatchModifyStatusControl.ascx.cs"
    Inherits="Besture.UI.Admin.Control.BatchModifyStatusControl" %>
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
    <ContentTemplate>
        <table class="tablePrice">
            <tr>
                <th>
                    酒店名称：
                </th>
                <td colspan="3">
                    <asp:DropDownList runat="server" ID="ddlUpdateHotels" />
                    <span id="RoomName"></span>
                </td>
            </tr>
            <tr>
                <th>
                    选择日期：
                </th>
                <td>
                    <input type="text" class="Wdate" id="txtStartRoomTime" onfocus="WdatePicker({minDate:'%y-%M-{%d}',maxDate:'#F{$dp.$D(\'txtEndRoomTime\',{d:0});}'})" />
                    至
                    <input type="text" class="Wdate" id="txtEndRoomTime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtStartRoomTime\',{d:0});}'})" />
                </td>
                <td style="border-right: 1px solid #d6d6d6;">
                   <%-- <asp:Button ID="btnSeach" runat="server" class="btn_blue" Text="添加条目" OnClick="BtnSeachClick" />--%>
                </td>
            </tr>
            <tr>
                <th>
                    设置房态：
                </th>
                <td colspan="3">
                    <asp:DropDownList runat="server" ID="ddlRoomStatus" />
                    <span id="Span1"></span>
                </td>
            </tr>
            <tr>
                <th>
                    设置房间数量：
                </th>
                <td colspan="3">
                    <asp:RadioButton ID="rabNumber" Text="不做修改" Checked="True" GroupName="Number" runat="server" />
                    <asp:RadioButton ID="rabAddRoom" Text="增加" GroupName="Number" runat="server" />
                    <asp:TextBox runat="server" ID="txtAddNumber" MaxLength="2" Width="20"></asp:TextBox>间
                    <asp:RadioButton ID="rabCutBack" Text="减少" GroupName="Number" runat="server" />
                    <asp:TextBox runat="server" ID="txtCutBackNumber" MaxLength="2" Width="20"></asp:TextBox>间
                </td>
            </tr>
            <tr>
                <th>
                   限量售卖： 
                </th>
                <td>
                    <asp:TextBox runat="server" ID="txtLimitedSale" CssClass="number"  Text="0"  Width="50"></asp:TextBox>
                </td>
            </tr>
        </table> 
        <div style="text-align: center; margin-top: 15px;">
            <asp:Button runat="server" ID="Button1" CssClass="btn-sure btn-edit" Text="保存" OnClick="BtnSubmitClick"
                OnClientClick="return btnStatusClick();" />
        </div>
        <input type="hidden" id="hidRoomID" runat="server" />
        <input type="hidden" id="hidID" runat="server" value="0" />
        <input type="hidden" id="hidStartRoomTime" runat="server" value="0" />
        <input type="hidden" id="hidEndRoomTime" runat="server" value="0" />
        <input type="hidden" id="hidPrice" runat="server" value="0" />
        <script>
            function getUpdateHotels() {
                $("#<%=ddlUpdateHotels.ClientID%>").change(function () {
                    $.ajax({
                        type: "GET",
                        url: "/Admin/RoomPrice/AJaxPrice.aspx",
                        data: {
                            "bm": "0",
                            Hotels: $("#<%=ddlUpdateHotels.ClientID%>").val()
                        },
                        success: function (data) {
                            if (data.length > 0) {
                                $("#RoomName").html(data.toString());
                            }
                        }
                    });
                });
            }

            function getBtnBlue() {

                $(".dxgvFilterRow_DevExOABlue").css("display", "none");

                //点击【添加条目】 触发事件
                $(".btn_blue").click(function () {

                });
            }

            //保存验证
            function btnStatusClick() {
                var roomId = '';
                $("input:checked[type=checkbox]").each(function () {
                    roomId += $(this).val() + ",";
                });
                //增加
                if ($("#ctl00_Content_BatchModifyPricesControl1_rabAddRoom").attr("checked") == "checked" && $("#ctl00_Content_BatchModifyPricesControl1_txtAddNumber").val() == "") {
                    alert("请输入增加的房间数！");
                    $("#ctl00_Content_BatchModifyPricesControl1_txtAddNumber").focus();
                    return false;
                }
                //减少
                if ($("#ctl00_Content_BatchModifyPricesControl1_rabCutBack").attr("checked") == "checked" && $("#ctl00_Content_BatchModifyPricesControl1_txtCutBackNumber").val() == "") {
                    alert("请输入减少的房间数！");
                    $("#ctl00_Content_BatchModifyPricesControl1_txtCutBackNumber").focus();
                    return false;
                }
                if (roomId.length < 1) {
                    alert("请选择房型");
                    return false;
                } else if ($("#txtStartRoomTime").val().length < 1 || $("#txtEndRoomTime").val().length < 1) {
                    alert("请选择日期");
                    return false;
                } else {
                    $("#<%=hidRoomID.ClientID%>").val(roomId); //获取 房型id
                    $("#<%=hidID.ClientID%>").val(1); //标示字段
                    //$("").find("input").remove(); //处理input 校验

                    $("#<%=hidStartRoomTime.ClientID%>").val($("#txtStartRoomTime").val());
                    $("#<%=hidEndRoomTime.ClientID%>").val($("#txtEndRoomTime").val());
                    return true;
                }
            }

            $(function () {
                $("#ctl00_Content_BatchModifyPricesControl1_txtAddNumber").focus(function () {
                    $("#ctl00_Content_BatchModifyPricesControl1_rabAddRoom").attr("checked", true);
                });
                $("#ctl00_Content_BatchModifyPricesControl1_txtCutBackNumber").focus(function () {
                    $("#ctl00_Content_BatchModifyPricesControl1_rabCutBack").attr("checked", true);
                });
            });


            function myValidate() {





                var arr = new Array();
                $(".dxgvTable_DevExOABlue").find(".dxgvDataRow_DevExOABlue").each(function (i) {
                    arr[i] = $(this).find("#ctl00_Content_BatchModifyPricesControl_grid_tccell" + i + "_1").find("span").attr("tabindex"); //房型ID
                    //arr[i] += "," + $(this).find("#ctl00_Content_BatchModifyPricesControl_grid_tccell" + i + "_3").find("input").val();//预付底价 
                    arr[i] += "," + $(this).find("#ctl00_Content_BatchModifyPricesControl_grid_tccell" + i + "_4").find("input").val(); //会员价格 
                    arr[i] += "," + $(this).find("#ctl00_Content_BatchModifyPricesControl_grid_tccell" + i + "_5").find("input").val(); //一级经销商价 
                    arr[i] += "," + $(this).find("#ctl00_Content_BatchModifyPricesControl_grid_tccell" + i + "_6").find("input").val(); //二级经销商价 
                    arr[i] += "," + $(this).find("#ctl00_Content_BatchModifyPricesControl_grid_tccell" + i + "_7").find("input").val(); //三级经销商价 
                    arr[i] += "," + $(this).find("#ctl00_Content_BatchModifyPricesControl_grid_tccell" + i + "_8").find("select").val(); //早餐情况
                    arr[i] += "|";
                });
                $("#<%=hidPrice.ClientID %>").val(arr);

                $(".pop-box input").addClass("ignore");
                return $("form").valid();
            }

            $(function () {
                //酒店名称控件 初始化 下拉框
                getUpdateHotels();
                //【添加条目】 初始化 触发事件
                getBtnBlue();
            });

        </script>
    </ContentTemplate>
    <Triggers>
        <asp:PostBackTrigger ControlID="Button1" />
    </Triggers>
</asp:UpdatePanel>
